Block Api
Functions
Add a source to the sourceSet property of the given block. If there already exists in source set an image with the same width, that existing image will be replaced. If the source set is or gets empty, the crop and content fill mode of the associated block will be set to the default values. Note: This fetches the resource from the given URI to obtain the image dimensions. It is recommended to use setSourceSet if the dimension is known.
Add a source to the sourceSet property of the given block. If there already exists in source set an image with the same width, that existing image will be replaced. If the source set is or gets empty, the crop and content fill mode of the associated block will be set to the default values. Note: This fetches the resource from the given URI to obtain the image dimensions. It is recommended to use setSourceSet if the dimension is known.
Add a source to the sourceSet property of the given block. If there already exists in source set a video with the same width, that existing video will be replaced. If the source set is or gets empty, the crop and content fill mode of the associated block will be set to the default values. Note: This fetches the resource from the given URI to obtain the video dimensions. It is recommended to use setSourceSet if the dimension is known.
Adjust the crop position/scale to at least fill the crop frame. Required scope: "layer/crop"
Align multiple blocks vertically within their bounding box or a single block to its parent. Required scope: "layer/move"
Align multiple blocks vertically within their bounding box or a single block to its parent. Required scope: "layer/move"
Appends a new or existing child to a block's children. A move fails when it would put a block with a matte inside its matte source, or on another page than its source. Required scope: "editor/add"
Inserts an effect at the end of the list of effects. The same effect can appear multiple times in the list and won't be removed if appended again. Required scope: "appearance/effect"
Inserts a mask at the end of the masks of the block. A mask can be used by more than one block. Required scope: "layer/clipping" Experimental: this API may change in a minor release.
Appends a modifier to the modifiers of a shape. The same modifier can appear multiple times in the list. Required scope: "shape/change" on every block that uses the shape. Experimental: this API may change in a minor release.
Appends a subshape to a compound shape. A shape has one owner, so the subshape is detached from its previous block or compound shape. Line shapes cannot be subshapes. The call fails when the shape tree would nest more than 128 shapes. Required scope: "shape/change" Experimental: this API may change in a minor release.
Appends a text animator to the text animators of a block. A text animator belongs to one block at a time. Required scope: "appearance/animation" Experimental: this API may change in a minor release.
Updates the sorting order of this block and all of its superjacent siblings so that the given block has a higher sorting order than the next superjacent sibling. If the block is parented to a track, it is first moved up in the hierarchy. Empty tracks and empty groups are passed by.
Updates the sorting order of this block and all of its manually created siblings so that the given block has the highest sorting order. If the block is parented to a track, it is first moved up in the hierarchy.
Query if the given block can be reverted to the intrinsic aspect ratio of its image/video content. Backs the "Original" crop preset (AssetTransformPreset.ContentAspectRatio).
Returns whether the font weight of the given block can be toggled between bold and normal.
Returns whether the font style of the given block can be toggled between italic and normal.
Perform a boolean operation on the given blocks.
Create a new block.
Creates a new animation, fails if type is unknown.
Create a new audio block by extracting a specific audio track from a video fill block.
Create multiple audio blocks by extracting all audio tracks from a video fill block.
Create a new blur, fails if type is unknown or not a valid blur type.
Creates new caption blocks from the given file.
Create a cutout block whose path will be the contour of the given blocks. The cutout path for each block is derived from one of the two ways:
Perform a boolean operation on the given Cutout blocks. The cutout offset of the new block is 0. The cutout type of the new block is that of the first block. When performing a CutoutOperation.DIFFERENCE operation, the first block is the block subtracted from.
Create a Cutout block.
Create a new effect block, fails if type is unknown or not a valid effect block type.
Create a new fill, fails if type is unknown.
Create a new mask block. A mask cuts its block down to the area of the mask's shape. Give the mask a shape with setShape; a mask without a shape has no effect. The shape is evaluated in the frame of the block that the mask is attached to. The mask properties are mask/mode, mask/opacity, mask/feather, mask/expansion and mask/inverted. Experimental: this API may change in a minor release.
Create a new shape modifier block, fails if type is unknown or not a valid modifier block type. A modifier changes the path of a shape, or draws the shape several times. Experimental: this API may change in a minor release.
Create a new shape, fails if type is unknown.
Create a new text animator block. A text animator changes the glyphs of a text block that its range selector covers: their position, scale, rotation, skew, opacity, colors, stroke width, tracking and blur. Every property of a text animator can have keyframes. Experimental: this API may change in a minor release.
Creates a new transition, fails if type is unknown.
Destroys a block. Required scope: "lifecycle/destroy"
Distribute multiple blocks vertically within their bounding box so that the space between them is even. Required scope: "layer/move"
Distribute multiple blocks vertically within their bounding box so that the space between them is even. Required scope: "layer/move"
Duplicates a block including its children. Required scope: "lifecycle/duplicate" If the block is parented to a track that is set always-on-bottom, the duplicate is inserted in the same track immediately after the block. Otherwise, the duplicate is moved up in the hierarchy.
Changes selection from selected group to a block within that group. Nothing happens if block is not a group. Required scope: "editor/select"
Changes selection from a group's selected block to that group. Nothing happens if block is not a group. Required scope: "editor/select"
Exports a design block element as a PDF and emits the bytes as chunks while they are produced, so the document is never held in memory as a whole. This is the same export as the export overload that takes an OutputStream. Prefer that overload when the destination is a file, a content:// target or an upload stream, and this one when the chunks feed a coroutine pipeline. Performs an internal update to resolve the final layout for the blocks. Note: The returned flow is cold. Each collection runs one export, which starts when the collection starts, and the flow completes after the last chunk. Collect it on the engine thread, like every other engine call. Note: The flow has no buffer. The encoder waits until the collector has taken a chunk, so a slow collector slows the encoder down and the chunks do not queue up in memory. A collector that keeps the chunks, for example with toList(), holds the whole document in memory again. Note: When the collector leaves or its coroutine is cancelled, the export stops. Note: This overload has no mimeType parameter, because a streamed export supports MimeType.PDF only. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance and is alive until the collection ends. Use this lambda to configure the background engine for export. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Exports a design block element as a file of the given mime type. Performs an internal update to resolve the final layout for the blocks. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance and is alive until the suspending function resumes. Use this lambda to configure the background engine for export. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Exports multiple design block elements as files of the given mime type. Performs an internal update to resolve the final layout for the blocks. This method is more memory efficient than calling export repeatedly for multiple blocks as it reuses a single worker engine for all exports. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance and is alive until the suspending function resumes. Use this lambda to configure the background engine for export. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Exports a design block element as a PDF and writes the bytes into output while they are produced, so the document is never held in memory as a whole. Prefer this over the export that returns a ByteBuffer for large multi-page documents such as photo books and magazines: the peak memory is the working set of one page, whatever the number of pages. Performs an internal update to resolve the final layout for the blocks. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance and is alive until the suspending function resumes. Use this lambda to configure the background engine for export. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver). Note: output is written from that background thread with one write for each chunk, so a slow destination slows the encoder down and the chunks do not queue up in memory. ExportOptions.pdfChunkSize bounds the size of a chunk. The caller keeps the ownership of output and closes it, for example with use. Note: When the export fails or the calling coroutine is cancelled, the export stops and output holds an incomplete document. A write that blocks delays the cancellation until it returns.
Exports a design block as a video file of the given mime type. Note: MP4 exports embed a PNG cover at the page playback position unless coverTimeOffset overrides it. Note: The export will run across multiple iterations of the update loop. In each iteration a frame is scheduled for encoding. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance and is alive until the suspending function resumes. Use this lambda to configure the background engine for export. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Exports multiple design blocks as video files of the given mime type. Note: MP4 exports embed a PNG cover at the page playback position unless coverTimeOffset overrides it. Videos are exported sequentially, with progress reported for each video. This method is more memory efficient than calling exportVideo repeatedly for multiple blocks as it reuses a single worker engine for all exports. Note: The export will run across multiple iterations of the update loop. In each iteration a frame is scheduled for encoding. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance and is alive until the suspending function resumes. Use this lambda to configure the background engine for export. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Exports a design block element as a file of the given mime type. Performs an internal update to resolve the final layout for the blocks. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance and is alive until the suspending function resumes. Use this lambda to configure the background engine for export. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Exports multiple design block elements as files of the given mime type with color masks. Performs an internal update to resolve the final layout for the blocks. This method is more memory efficient than calling exportWithColorMask repeatedly for multiple blocks as it reuses a single worker engine for all exports. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance and is alive until the suspending function resumes. Use this lambda to configure the background engine for export. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Resize and position a block to entirely fill its parent block. The crop values of the block, except for the flip and crop rotation, are reset if it can be cropped. If the size of the block's fill is unknown, the content fill mode is changed from Crop to Cover to prevent invalid crop values. A block that follows a transform parent stops following it. Required scope: "layer/move"
Return all blocks currently known to the engine.
Returns all blocks that overlap an exclusion area on their page.
Query all metadata keys that exist on this block.
Return all placeholder blocks in the current scene.
Get all available properties of a block.
Get all currently selected blocks.
Return all blocks that are not attached to any scene.
Get the properties of a block that are bound to a variable. Experimental: this API may change in a minor release.
Finds all blocks with the given kind.
Finds all blocks with the given name.
Finds all design blocks with the given type.
Finds all blur blocks with the given type.
Finds all effect blocks with the given type.
Finds all mask blocks. Experimental: this API may change in a minor release.
Finds all modifier blocks with the given type. Experimental: this API may change in a minor release.
Finds all shape blocks with the given type.
Finds all text animator blocks. Experimental: this API may change in a minor release.
Adjusts the crop in order to flip the content along its own horizontal axis.
Adjusts the crop in order to flip the content along its own vertical axis.
Begins loading the required audio and video resource for the given video fill or audio block. If the resource had been loaded earlier and resulted in an error, it will be reloaded. A buffer:// source loads like a file. The call finishes once the engine can read the video, audio or Lottie in the buffer, with the images that a Lottie references. It fails when the buffer holds no file that it can read. A missing or empty buffer, or raw audio samples on an audio block, finish at once.
Begins loading the resources of the given blocks and their children. If the resource had been loaded earlier and resulted in an error, it will be reloaded. Note: This function is useful for preloading resources before they are needed. Warning: For elements with a source set, all elements in the source set will be loaded.
Generate a thumbnail sequence for the given audio block or video fill. A thumbnail in this case is a chunk of samples in the range of 0 to 1. In case stereo data is requested, the samples are interleaved, starting with the left channel. Note: Only one request per block runs at a time. A second request for the same block waits for the first to finish instead of failing. Note: numberOfSamples counts samples per channel, so each emission carries samplesPerChunk * numberOfChannels floats and the last one may be shorter. Note: A chunk arrives at the end of an engine update. Cancelling the collecting coroutine also drops the chunks that wait for delivery. Note: Collect on the main thread; collection throws otherwise.
Generate a thumbnail sequence for the given video fill or design block. Note: Only one request per block runs at a time. A second request for the same block waits for the first to finish instead of failing. Note: For a video fill, cancelling has no effect once the first frame has been scheduled — the engine still produces the remaining frames. Cancelling the collecting coroutine stops your collector from seeing them. Design block sequences cancel at any time. Note: A frame arrives at the end of an engine update, after the update that rendered it. Note: Collect on the main thread; collection throws otherwise.
Get the properties of a block that have keyframes. Experimental: this API may change in a minor release.
Get information about all audio tracks from a video fill block.
Get the number of available audio tracks in a video fill block.
Get the duration in seconds of the video or audio resource that is attached to the given block.
Get the background color of the given design block.
Get the blend mode of the given design block.
Get the blur block of the given design block.
Get the value of a boolean property of the given design block.
Get all children of the given block. Children are sorted in their rendering order: Last child is rendered in front of other children.
Get the value of a color property of the given design block.
Get the spot color name of a color property of the given design block.
Get the spot color tint factor of a color property of the given design block.
Query a block's horizontal content fill alignment.
Query a block's content fill mode.
Query a block's vertical content fill alignment.
Get the crop rotation of the given design block.
Get the crop scale ratio of the given design block.
Get the crop scale in x direction of the given design block.
Get the crop scale in y direction of the given design block.
Get the crop translation in x direction of the given design block.
Get the crop translation in y direction of the given design block.
Extracts the dominant colors from the rendered appearance of a block.
Get the value of a double property of the given design block.
Get the drop shadow's blur radius on the x axis of the given design block.
Get the drop shadow's blur radius on the y axis of the given design block.
Get the drop shadow's clipping of the given design block.
Get the drop shadow color of the given design block.
Get the drop shadow's x offset of the given design block.
Get the drop shadow's y offset of the given design block.
Get the playback duration of the given block in seconds. The duration defines for how long the block is active in the scene during playback. Note: The duration is ignored when the scene is not in Video mode.
Get a list of all effects attached to this block.
Get the block that an effect block reads. Experimental: this API may change in a minor release.
Get the value of an enum property of the given design block.
Get all the possible values of an enum given an enum property.
Returns the block containing the fill properties of the given block.
Query whether the fill of the given design block is marked as overprint.
Get the fill color of the given design block.
Get the value of a float property of the given design block.
Get a block's layout height. The layout height is only available after an internal update loop, which may not happen immediately.
Get a block's layout width. The layout width is only available after an internal update loop, which may not happen immediately.
Get a block's layout position on the x-axis. The layout position is only available after an internal update loop, which may not happen immediately.
Get a block's layout position on the y-axis. The layout position is only available after an internal update loop, which may not happen immediately.
Get the height of the block's axis-aligned bounding box in the scene's global coordinate space. The scene's global coordinate space has its origin at the top left.
Get the width of the block's axis-aligned bounding box in the scene's global coordinate space. The scene's global coordinate space has its origin at the top left.
Get the x position of the block's axis-aligned bounding box in the scene's global coordinate space. The scene's global coordinate space has its origin at the top left.
Get the y position of the block's axis-aligned bounding box in the scene's global coordinate space. The scene's global coordinate space has its origin at the top left.
Get the gradient color stops property of the given design block.
Query a block's height.
Query a block's mode for its height.
Get the "in" animation of the given block.
Get the value of an int property of the given design block.
Get the mode of the keyframe track of a block property. Throws when the property has no keyframes. Experimental: this API may change in a minor release.
Get the keyframes of a block property, sorted by time. Experimental: this API may change in a minor release.
Get the kind of the given block, fails if the block is invalid.
Get the "loop" animation of the given block.
Get the masks of a block, in the order in which they combine. Experimental: this API may change in a minor release.
Get the matte of a block. Experimental: this API may change in a minor release.
Get a metadata value of a block identified by a key. If the key does not exist, yet, this method will fail.
Get the modifiers of a shape, in the order they apply to its path. Experimental: this API may change in a minor release.
Get a block's name.
Get the opacity of the given design block.
Gets the "out" animation of the given block.
Query a block's parent.
Gets the playback speed multiplier of a block that supports playback control.
Get the playback time of the given block.
Query a block's x position.
Query a block's mode for its x position.
Query a block's y position.
Query a block's mode for its y position.
Get the type of a property given its name.
Query a block's rotation in radians.
Get the position and size of the axis-aligned bounding box for the given blocks in screen space.
Returns the block containing the shape properties of the given block.
Returns the source set of a source set property of the given block.
Get the name of the spot color assigned to a cutout type.
Get the current state of a block. Note If this block is in error state or this block has a Shape block, Fill block or Effect block(s), that is in error state, the returned state will be BlockState.Error. Else, if this block is in pending state or this block has a Shape block, Fill block or Effect block(s), that is in pending state, the returned state will be BlockState.Pending. Else, the returned state will be BlockState.Ready. A BlockState.Error carries the catalog error of the failed load in BlockState.Error.engineError when the engine knows it, such as a .lottie archive that cannot be read or a video that cannot be decoded. Note: A block whose CMYK or spot color needs the document CMYK profile is BlockState.Pending while that profile loads. Note: Runs an engine update when the block names a resource that nothing asked for yet. A font set just before this call is then reported as pending.
Get the value of a string property of the given design block.
Get the legacy single stroke cap of the given design block. Tracks the value last written via setStrokeCap or setStrokeStartCap; ignores changes made via setStrokeEndCap.
Get the stroke color of the given design block.
Get the stroke corner geometry of the given design block.
Get the custom dash pattern of the given design block's stroke.
Query the cap geometry at the trailing edge of each dash piece.
Get the dash offset of the given design block's stroke.
Query the cap geometry at the leading edge of each dash piece.
Query the cap geometry at the end of an open stroked path.
Returns the fill block that paints the stroke of the given block. Experimental: this API may change in a minor release.
Query whether the stroke of the given design block is marked as overprint.
Get the stroke position of the given design block.
Query the cap geometry at the start of an open stroked path.
Get the stroke style of the given design block.
Get the stroke width of the given design block.
Get the subshapes of a compound shape, in the order in which they combine. Experimental: this API may change in a minor release.
Get the text animators of a block, in the order they apply. Experimental: this API may change in a minor release.
Returns the ordered unique list of background colors of the text in the selected range. Text without a background color is reported as a fully transparent color.
Returns the unique baseline shift values across the grapheme range, in design units. Experimental: this API may change in a minor release.
Returns the ordered list of text cases of the text in the selected range.
Returns the tight ink-paint bounding box of each grapheme in the given range. Required scope: "text/character"
Returns the ordered unique list of colors of the text in the selected range.
Returns the indices of the selected range of the text block that is currently being edited. If both the start and end index of the returned range have the same value, then the text cursor is positioned at that index.
Returns the ordered list of unique text decoration configurations in the selected range.
Gets the effective horizontal alignment of a text block. If the alignment is set to Auto, this returns the resolved alignment (Left or Right) based on the text direction of the first logical run. This never returns 'Auto'.
Returns the ordered unique list of font sizes of the text in the selected range.
Returns the ordered unique list of font styles of the text in the selected range.
Returns the ordered unique list of font weights of the text in the selected range.
Returns the paragraph-level horizontal alignment override for a specific paragraph, or the block-level alignment for negative paragraph indices.
Returns the unique kerning values across the grapheme range.
Returns the bounds of the visible area of the given line of the text block. The values are in the scene's global coordinate space (which has its origin at the top left).
Returns the line height multiplier for a specific paragraph of a text block.
Returns the list nesting level for a specific paragraph of a text block.
Returns the list style for a specific paragraph of a text block.
Returns the SVG path currently used as the text block's baseline, or null if normal layout is active.
Returns whether text is placed on the opposite side of the baseline path.
Returns the start offset along the baseline path as a proportion of the path length.
Returns the 0-based paragraph indices that overlap the given range.
Returns all text runs within the given range of text.
Returns the ordered list of unique script styles of the text in the selected range.
Returns the text content of the given visible line of the text block.
Returns the number of visible lines in the given text block.
Get the time offset of the given block relative to its parent.
Returns the total duration (in seconds) of a scene in video mode. The duration is defined by all blocks in the scene.
Returns the block whose transform the given block follows. Experimental: this API may change in a minor release.
Gets the outgoing transition assigned to a clip.
Get the trim length of the given block or fill.
Get the trim offset of this block. Note: This requires the video or audio clip to be loaded.
Get the type of the given block, fails if the block is invalid.
Returns the typeface property of the text block. Does not return the typefaces of the text runs.
Returns the typefaces of the text block.
Get the value of a uri property of the given design block.
Get a block's unique identifier.
Get the variable that a block property is bound to. Experimental: this API may change in a minor release.
Get the value of a vec2 property of the given design block. Experimental: this API may change in a minor release.
Get the video height in pixels of the video resource that is attached to the given block.
Get the video width in pixels of the video resource that is attached to the given block.
Get the audio volume of the given block.
Query a block's width.
Query a block's mode for its width.
Group blocks together.
Query if the given block has background color properties.
Query if the given block has a blend mode.
Checks whether the block supports blur.
Query if the given block has a content fill mode.
Query if the given block has crop properties.
Query if the given block has a drop shadow property.
Returns whether the block has a duration property.
Checks whether an effect block may be enabled and disabled.
Queries whether the block supports effects.
Query if the given block has fill color properties.
Check if the block has metadata associated with the key.
Query if the given block has an opacity.
Query whether the block supports placeholder behavior.
Checks whether the block supports placeholder controls.
Returns whether the block supports a playback control.
Returns whether the block has a playback time property.
Query if the given block has a shape property.
Query if the given block has a stroke property.
Returns whether the block has a time offset property.
Returns whether a block has its own anchor. Setting transform/anchor/x or transform/anchor/y, even to 0, or giving one of them keyframes, gives a block an anchor. A rotation keyframe track turns a block with an anchor around the anchor, and a block without one around its frame center, as setRotation does. Experimental: this API may change in a minor release.
Returns whether the block has trim properties.
Insert a new or existing child at a certain position in the parent's children. A move fails when it would put a block with a matte inside its matte source, or on another page than its source. Required scope: "editor/add"
Inserts an effect at the given index into the list of effects of the given block. The same effect can appear multiple times in the list and won't be removed if appended again. Required scope: "appearance/effect"
Inserts a mask at the given index into the masks of the block. A mask can be used by more than one block. Required scope: "layer/clipping" Experimental: this API may change in a minor release.
Inserts a modifier at the given index into the modifiers of a shape. The same modifier can appear multiple times in the list. Required scope: "shape/change" on every block that uses the shape. Experimental: this API may change in a minor release.
Inserts a subshape at the given index of a compound shape. The subshape at index 0 is the base, and each later subshape combines with the result so far by shape/compound/mode. The placement properties of the subshape (shape/position/x, shape/width, shape/rotation, ...) place it in the compound's coordinate space. A shape has one owner, so the subshape is detached from its previous block or compound shape. Line shapes cannot be subshapes. The call fails when the shape tree would nest more than 128 shapes. Required scope: "shape/change" Experimental: this API may change in a minor release.
Inserts a text animator at the given index into the text animators of a block. A text animator belongs to one block at a time. Required scope: "appearance/animation" Experimental: this API may change in a minor release.
Confirms that a given set of blocks can be aligned.
Check if a scope is allowed for a given block.
Query a block's always-on-bottom property.
Query a block's always-on-top property.
Returns whether the audio and video resource for the given video fill or audio block is loaded. Note that the function is unstable and mared with UnstableEngineApi. A buffer:// source counts as loaded once the engine has read its file, with the images that a Lottie references. A missing or empty buffer, or raw audio samples on an audio block, count as loaded.
Query if the background of the given design block is enabled.
Query if blur is enabled for the given block.
Query a block's clipped state. If true, the block should clip
Checks whether blocks could be combined.
Check if the crop aspect ratio is locked for the given block. When locked, crop handles will maintain the current aspect ratio during resize.
Confirms that a given set of blocks can be distributed.
Query if the drop shadow of the given design block is enabled.
Queries whether an effect block is enabled and therefore applies its effect.
Query if the fill of the given design block is enabled.
Query a block's horizontal flip state.
Query a block's vertical flip state.
Query whether the block is muted due to engine constraints.
Confirms that a given set of blocks can be grouped together.
Query if the given block is included on the exported result.
Checks whether a graphic block originated as a line shape.
Query whether the block is looping.
Query whether the block is muted.
Returns whether the block is a duration source block.
Query whether the placeholder behavior for a block is enabled.
Query whether the placeholder button for a block is shown.
Query whether the placeholder overlay pattern for a block is shown.
Query whether the placeholder function for a block is enabled.
Returns whether the block is currently during active playback.
Check whether a property of a block can have keyframes. Experimental: this API may change in a minor release.
Check if a property with a given name is readable.
Check if a property with a given name is writeable.
Check if a property with a given name is writeable.
Query whether a scope is enabled for a given block.
Get the selected state of a block.
Return whether the given block or fill is currently set to play its contents while the rest of the scene remains paused.
Query if the stroke of the given design block is enabled.
Query a block's transform locked state. If true, the block's transform can't be changed. The lock covers the static transform: keyframe tracks on the position, rotation, size, scale, anchor or skew still animate a locked block.
Check if a block is valid. A block becomes invalid once it has been destroyed.
Query a block's visibility.
Returns whether the block should be visible on the canvas at the current playback time.
Loads existing blocks from an archive. The archiveUri should be that of a file previously saved with saveToArchive. The blocks are not attached by default and won't be visible until attached to a page or the scene. The UUID of the loaded blocks is replaced with a new one.
Loads existing blocks from the given string. The blocks are not attached by default and won't be visible until attached to a page or the scene. The UUID of the loaded blocks is replaced with a new one.
Loads existing blocks from a URL.
Subscribe to block click events. Note: DesignBlock is emitted at the end of the engine update if it has been clicked.
Subscribe to changes in the current set of selected blocks.
Subscribe to changes to the state of a block. Like getState, the state of a block is determined by the state of itself and its Shape, Fill and Effect block(s).
Checks whether the given block references any text variables. Doesn't check the block's children or its variable bindings.
Removes the effect at the given index. Required scope: "appearance/effect"
Remove the keyframe track of a block property, so the static value applies again. Does nothing when the property has no keyframes. Required scope: the scopes that setKeyframes needs for the removed track. Experimental: this API may change in a minor release.
Removes the mask at the given index. The mask block is not destroyed. Required scope: "layer/clipping" Experimental: this API may change in a minor release.
Remove metadata associated with the key from the given block.
Removes the modifier at the given index from the modifiers of a shape. The modifier is not destroyed. Required scope: "shape/change" on every block that uses the shape. Experimental: this API may change in a minor release.
Remove the block as duration source block for the page. If a scene or page given set as block, it is deactivated for all blocks in the scene or page.
Removes the subshape at the given index of a compound shape. The subshape is not destroyed. Required scope: "shape/change" Experimental: this API may change in a minor release.
Removes selected range of text of the given text block. Required scope: "text/edit"
Removes the text animator at the given index from a block. The text animator is not destroyed. Required scope: "appearance/animation" Experimental: this API may change in a minor release.
Removes the outgoing transition of a clip.
Remove the variable binding of a block property. The property keeps its current value. Does nothing if the property is not bound. Experimental: this API may change in a minor release.
Inserts the given text into the selected range of the text block. Required scope: "text/edit"
Resets the manually set crop of the given design block. The block's content fill mode is set to ContentFillMode.COVER. If the block has a fill, the crop values are updated so that it covers the block. Required scope: "layer/crop"
Resize all blocks to the given size. The content of the blocks is automatically adjusted to fit the new dimensions. Required scope: "layer/resize"
Saves the given blocks to an archive. Note: All given block handles must be valid, otherwise this call returns an error.
Saves the given blocks to a proprietary string. If given the root of a block hierarchy, e.g. a page with multiple children, the entire hierarchy is saved. If a resource uri of any block in that hierarchy has a scheme that is not in allowedResourceSchemes, an exception will be thrown. Note: All given block handles must be valid, otherwise an exception will be thrown.
Scales the block and all of its children proportionally around the specified relative anchor point. This updates the position, size and style properties (e.g. stroke width) of the block and its children. Required scope: "layer/resize"
Selects the given block and deselects all other blocks.
Updates the sorting order of this block and all of its manually created and subjacent siblings so that the given block will have a lower sorting order than the next subjacent sibling. If the block is parented to a track, it is first moved up in the hierarchy. Empty tracks and empty groups are passed by.
Updates the sorting order of this block and all of its manually created siblings so that the given block has the lowest sorting order. If the block is parented to a track, it is first moved up in the hierarchy.
Update the block's always-on-bottom property. If true, this blocks's global sorting order is automatically adjusted to be lower than all other siblings without this property. If more than one block is set to be always-on-bottom, the child order decides which is on the bottom.
Update the block's always-on-top property. If true, this blocks's global sorting order is automatically adjusted to be higher than all other siblings without this property. If more than one block is set to be always-on-top, the child order decides which is on top.
Set an audio fade-in for the given block. The audio ramps up from silence to the block's volume over the given duration at the start of the block.
Set an audio fade-out for the given block. The audio ramps down from the block's volume to silence over the given duration at the end of the block.
Set the background color of the given design block. Required scope: "fill/change"
Enable or disable the background of the given design block. Required scope: "fill/change"
Set the blend mode of the given design block. Required scope: "layer/blendMode"
Enable or disable the blur of the given design block.
Set a boolean property of the given design block to the given value.
Update a block's clipped state. Required scope: "layer/clipping"
Set a color property of the given design block to the given value.
Set a color property of the given design block to the given value.
Set the horizontal alignment of the content fill inside the block.
Set a block's content fill mode. Required scope: "layer/crop"
Set the vertical alignment of the content fill inside the block.
Set whether the crop aspect ratio should be locked for the given block. When enabled, the block will have a FixedAspectRatioTag and crop handles will maintain aspect ratio. When disabled, the FixedAspectRatioTag will be removed and free resizing is allowed. Required scope: "layer/crop"
Set the crop rotation of the given design block. Required scope: "layer/crop"
Set the crop scale ratio of the given design block. This will uniformly scale the content up or down. The center of the scale operation is the center of the crop frame. Required scope: "layer/crop"
Set the crop scale in x direction of the given design block. Required scope: "layer/crop"
Set the crop scale in y direction of the given design block. Required scope: "layer/crop"
Set the crop translation in x direction of the given design block. Required scope: "layer/crop"
Set the crop translation in y direction of the given design block. Required scope: "layer/crop"
Set a double property of the given design block to the given value.
Set the drop shadow's blur radius on the x axis of the given design block. Required scope: "appearance/shadow"
Set the drop shadow's blur radius on the y axis of the given design block. Required scope: "appearance/shadow"
Set the drop shadow's clipping of the given design block. (Only applies to shapes.) Required scope: "appearance/shadow"
Set the drop shadow color of the given design block. Required scope: "appearance/shadow"
Enable or disable the drop shadow of the given design block. Required scope: "appearance/shadow"
Set the drop shadow's x offset of the given design block. Required scope: "appearance/shadow"
Set the drop shadow's y offset of the given design block. Required scope: "appearance/shadow"
Set the playback duration of the given block in seconds. The duration defines for how long the block is active in the scene during playback. If a duration is set on the page block, it becomes the duration source block. Note: The duration is ignored when the scene is not in "Video" mode. Note: This also adjusts the trim for non looping blocks.
Sets the enabled state of an effect block.
Set the block that an effect block reads, such as the map of a displacement map effect. The source still draws on its own. It is read without its position and rotation, and also when it is hidden. Required scope: "appearance/effect" on every block the effect is attached to. Experimental: this API may change in a minor release.
Set an enum property of the given design block to the given value.
Sets the block containing the fill properties of the given block. Note: The previous fill block is not destroyed automatically. Required scopes: "fill/change", "fill/changeType"
Enable or disable the fill of the given design block. Required scope: "fill/change"
Mark the fill of the given design block as overprint for PDF export.
Set the fill color of the given design block. Required scope: "fill/change"
Update a block's horizontal flip. Required scope: "layer/flip"
Update a block's vertical flip. Required scope: "layer/flip"
Set a float property of the given design block to the given value.
Sets the given font and typeface for the text block. Existing formatting is reset. Required scope: "text/character"
Set a gradient color stops property of the given design block.
Update a block's height and optionally maintain the crop. If the crop is maintained, the crop values will be automatically adjusted. The content fill mode Cover is only kept if the features/transformEditsRetainCoverMode setting is enabled, otherwise it will change to Crop. If the size of a group is changed, both dimensions are modified and the aspect ratio of the group is kept. Required scope: "layer/resize"
Set a block's mode for its height. A switch between Absolute and Percent keeps the stored height and reads it in the new mode. Set the height after the mode, without maintainCrop: otherwise the crop is adjusted from the size that the old number has in the new mode. Required scope: "layer/resize"
Sets the "in" animation for the given block.
Set if you want the given design block to be included in exported result.
Set an int property of the given design block to the given value.
Replace the keyframe track of a block property. Keyframe times are normalized over the duration of the block, from 0 to 1. The engine sorts the keyframes by time. Setting the static value of the property does not change its keyframes. The keyframes belong to the block that owns the property. Replacing a fill, shape or effect does not move them to the new block. Scaling the block or changing the design unit also converts the keyframes of length and position properties, such as corner radii and position. Rotating or flipping the block turns or mirrors the keyframes of its position, rotation and skew with it. A group's keyframes turn with the group. A turn other than a half turn joins position/x and position/y tracks into one position track. They must share the mode, the times and the easings, and no position track may exist. Other axis tracks cannot turn: their Absolute values move with the block, and their Relative values stay. A rotation track turns a graphic or text without an anchor around its frame center, as setRotation does. With transform/anchor/x or transform/anchor/y set, even to 0, it turns around the anchor. The vec2 properties position (a block) and shape/position (a shape) animate the /x and /y properties together. Their spatialOut and spatialIn tangents curve the motion path. getVec2 and setVec2 read and write their static value. A position/x or position/y track overrides that axis of a position track. Position keyframes are in design units, also when the position mode is PositionMode.PERCENT. Required scope: "appearance/animation" and the scope that the setter of the property needs, such as "layer/move" for position or "layer/rotate" for rotation. A transform/scale/x or transform/scale/y keyframe that shows a scale with another sign than the static scale also needs "layer/flip". Experimental: this API may change in a minor release.
Set the kind of the given block, fails if the block is invalid.
Sets the "loop" animation for the given block.
Set whether the block should start from the beginning again or stop.
Mask a block with the rendered alpha or luminance of another block, like a track matte. A block used as a matte source is not drawn on its own. If the source draws nothing, for example because it is hidden or outside its time range, an alpha or luma matte hides the block and an inverted matte shows it whole. SVG export does not apply mattes, so a matted block exports whole. Required scope: "layer/clipping" on the block, and "layer/visibility" on the source, which stops drawing on its own. Experimental: this API may change in a minor release.
Set a metadata value of a block identified by a key. If the key does not exist, yet, it will be added.
Set whether the audio of the block is muted.
Update a block's name.
Update the pixels of the given pixelStreamFill block. This method should be called in order to bind a new android.graphics.SurfaceTexture to the pixelStreamFill, as well as after every android.graphics.SurfaceTexture.updateTexImage invocation. Note that the native texture is created only once: all subsequent calls on the same pixel stream fill will return the same id.
Set the opacity of the given design block. Required scope: "layer/opacity"
Sets the "out" animation for the given block.
Set a block as duration source so that the overall page duration is automatically determined by this. If no defining block is set, the page duration is calculated over all children. Only one block per page can be marked as duration source. Will automatically unmark the previously marked.
Enable or disable the placeholder behavior for a block.
Enable or disable the visibility of the placeholder button for a block.
Enable or disable the visibility of the placeholder overlay pattern for a block.
Enable or disable the placeholder function for a block.
Sets the playback speed multiplier of a block that supports playback control. Note: This also adjusts the trim and duration of the block. Video fills running faster than 3.0x are force muted until reduced to 3.0x or below. An audio block that createAudioFromVideo extracts from a video faster than 3.0x keeps that speed and is force muted too. This function still rejects a speed above 3.0x for it. On a group, the speed changes no duration and acts only when group/composition is true: the children then run that many times faster.
Set the playback time of the given block.
Set whether the block should be during active playback.
Update a block's x position. The position refers to the block's local space, relative to its parent with the origin at the top left. Required scope: "layer/move"
Set a block's mode for its x position. The position refers to the block's local space, relative to its parent with the origin at the top left. Required scope: "layer/move"
Update a block's y position. The position refers to the block's local space, relative to its parent with the origin at the top left. Required scope: "layer/move"
Set a block's mode for its y position. The position refers to the block's local space, relative to its parent with the origin at the top left. Required scope: "layer/move"
Update a block's rotation. Required scope: "layer/rotate"
Enable or disable a scope for a given block.
Update the selection state of a block. Fails for invalid blocks. Note: Previously selected blocks remain selected. Required scope: "editor/select"
Sets the block containing the shape properties of the given block. Note: The previous shape block is not destroyed automatically. Required scope: "shape/change"
Set whether the given block or fill should play its contents while the rest of the scene remains paused. Note: Setting this to true for one block will automatically set it to false on all other blocks.
Set the source set of a source set property of the given block. The crop and content fill mode of the associated block will be set to the default values.
Set the spot color assign to a cutout type. If no spot color is set, type CutoutType.SOLID is assigned "CutContour" and type CutoutType.DASHED is assigned "PerfCutContour". All cutout blocks of the given type will be immediately assigned that spot color.
Set the state of a block.
Set a string property of the given design block to the given value.
Set the stroke cap of the given design block. Writes both the start and end caps to the same value. Required scope: "stroke/change"
Set the stroke color of the given design block. Required scope: "stroke/change"
Set the stroke corner geometry of the given design block. Required scope: "stroke/change"
Set a custom dash pattern for the given design block's stroke. Semantics match SVG's stroke-dasharray: alternating on/off lengths in design-unit space. When the pattern is non-empty it overrides the preset implied by StrokeStyle. Pass an empty list to fall back to the preset. Required scope: "stroke/change"
Set the cap geometry at the trailing edge of each dash piece (excluding the line's actual end). Only takes effect when a dash pattern is active. Distinct from setStrokeEndCap, which only applies to the end of the open path itself.
Set the dash offset of the given design block's stroke. Semantics match SVG's stroke-dashoffset. Ignored when the custom dash pattern is empty. Required scope: "stroke/change"
Set the cap geometry at the leading edge of each dash piece (excluding the line's actual start). Only takes effect when a dash pattern is active. Distinct from setStrokeStartCap, which only applies to the start of the open path itself.
Enable or disable the stroke of the given design block. Required scope: "stroke/change"
Set the cap geometry at the end of an open stroked path.
Paints the stroke of the given block with a fill block, for example a gradient, instead of the stroke color. Color, gradient and stripe fills are supported; image, video and pixel stream fills are rejected. Note: The previous stroke fill block is not destroyed automatically. The fill block may not be the block's own fill. A stroke color with alpha 0 still hides the stroke; the fill's own colors set the opacity otherwise. Required scope: "stroke/change" Experimental: this API may change in a minor release.
Mark the stroke of the given design block as overprint for PDF export.
Set the stroke position of the given design block. Required scope: "stroke/change"
Set the cap geometry at the start of an open stroked path. Pair with setStrokeEndCap to set each end independently; setStrokeCap remains as a both-ends shortcut.
Set the stroke style of the given design block. Required scope: "stroke/change"
Set the stroke width of the given design block. Required scope: "stroke/change"
Changes the background color of the text in the selected range to the given color. The background is drawn as a rectangle behind each affected text run, or as a band along the curve for text on a path. A fully transparent color removes the background from the range. The run background is independent of the block-level background color ("backgroundColor/color"); it is drawn on top of the block-level background. Required scope: "fill/change"
Sets the baseline shift for a grapheme range. Moves the glyphs of the range up from the baseline, or down for a negative value. The line height does not change. Required scope: "text/character" Experimental: this API may change in a minor release.
Sets the given text case for the selected range of text. Required scope: "text/character"
Changes the color of the text in the selected range to the given color. Required scope: "fill/change"
Sets the text cursor range (selection) within the text block that is currently being edited. If from equals to, the cursor is positioned at that index.
Sets the text decoration for the selected range of text. Required scope: "text/character"
Changes the size of the text in the selected range to the given size. If the font size is applied to the entire text block, its font size property will be updated. Required scope: "text/character"
Changes the style of the text in the selected range to the given style. Required scope: "text/character"
Changes the weight of the text in the selected range to the given weight. Required scope: "text/character"
Sets the paragraph-level horizontal alignment override for one or all paragraphs of a text block. Required scope: "text/character"
Sets kerning for a grapheme range.
Sets the line height multiplier for a specific paragraph or all paragraphs of a text block. Required scope: "text/character"
Sets the list nesting level for a specific paragraph or all paragraphs of a text block. Required scope: "text/character"
Sets the list style for a specific paragraph or all paragraphs of a text block. Required scope: "text/character"
Sets or clears the SVG path that defines a text block's baseline.
Sets whether text is placed on the opposite side of the baseline path.
Sets the start offset along the baseline path as a proportion of the path length.
Sets the given script style for the selected range of text. Superscript and subscript text is scaled down and shifted off the regular baseline. The block properties "text/superscriptFontScale", "text/superscriptVerticalShift", "text/subscriptFontScale" and "text/subscriptVerticalShift" adjust the scale and shift. Required scope: "text/character"
Set the time offset of the given block relative to its parent. The time offset controls when the block is first active in the timeline. Note: The time offset is not supported by the page block.
Update a block's transform locked state.
Makes a block follow the transform of another block, or stops it from following one. The block's position, rotation and scale are then read in the local space of the transform parent, so the block moves with it. The block does not keep its place on screen when the link changes. Only the transform is inherited: opacity, visibility and the stacking order still come from the block's own parent. A hidden block can be a transform parent. When the transform parent is destroyed, the block stops following it. A block whose transform is locked can neither get nor lose a link. Required scope: "layer/move" Experimental: this API may change in a minor release.
Assigns the outgoing transition of a clip.
Set the trim length of the given block or fill. The trim length is the duration of the audio or video clip that should be used for playback. Note: After reaching this value during playback, the trim region will loop. Note: This requires the video or audio clip to be loaded.
Set the trim offset of the given block or fill. Sets the time in seconds within the fill at which playback of the audio or video clip should begin. Note: This requires the video or audio clip to be loaded.
Sets the given typeface for the text block. The current formatting, e.g., bold or italic, is retained as far as possible. Some formatting might change if the new typeface does not support it, e.g. thin might change to light, bold to normal, and/or italic to non-italic. If the typeface is applied to the entire text block, its typeface property will be updated. If a run does not support the new typeface, it will fall back to the default typeface from the typeface property. Required scope: "text/character"
Set a uri property of the given design block to the given value.
Bind a block property to a color, number, image or typeface variable, and apply the variable's current value. Color variables bind to color properties and number variables to float properties. Image variables bind only to "fill/image/imageFileURI", "fill/image/previewFileURI" and "fill/video/fileURI". Typeface variables bind only to "text/typeface" and "caption/typeface". A direct write to a bound property fails with BLOCK.PROPERTY_BOUND until the binding is removed. A bound typeface also locks setTypeface and setFont. On a text block, a variable bound to "fill/solid/color" or the font size sets every run of the text, and setTextColor or setTextFontSize fails for any range. Keyframes, undo and scene loads still change it. Changing the design unit converts a bound length. A number variable whose bound properties all hold its value converts with them. Otherwise the variable keeps its value, and the next variable write sets the lengths in the new unit. Experimental: this API may change in a minor release.
Set a vec2 property of the given design block to the given value. position sets position/x and position/y, and shape/position sets shape/position/x and shape/position/y, with the checks of those properties. Either both components change or neither does. Experimental: this API may change in a minor release.
Update a block's visibility. Required scope: "layer/visibility"
Set the audio volume of the given block.
Update a block's width and optionally maintain the crop. If the crop is maintained, the crop values will be automatically adjusted. The content fill mode Cover is only kept if the features/transformEditsRetainCoverMode setting is enabled, otherwise it will change to Crop. If the size of a group is changed, both dimensions are modified and the aspect ratio of the group is kept. Required scope: "layer/resize"
Set a block's mode for its width. A switch between Absolute and Percent keeps the stored width and reads it in the new mode. Set the width after the mode, without maintainCrop: otherwise the crop is adjusted from the size that the old number has in the new mode. Required scope: "layer/resize"
Split a block at the specified time. The original block will be trimmed to end at the split time, and the returned duplicate will start at the split time and continue to the original end time.
Returns whether the block supports animation.
Query if the given block has background color properties.
Query if the given block has a blend mode.
Checks whether the block supports blur.
Query if the given block has a content fill mode.
Query if the given block has crop properties.
Query if the given block has a drop shadow property.
Returns whether the block has a duration property.
Queries whether the block supports effects.
Query if the given block has fill color properties.
Checks whether the block supports masks. Graphic, text and group blocks do. Experimental: this API may change in a minor release.
Queries whether the block supports modifiers. Every shape block does. Experimental: this API may change in a minor release.
Query if the given block has an opacity.
Returns whether the block can be marked as the element that defines the duration of the given page.
Query whether the block supports placeholder behavior.
Checks whether the block supports placeholder controls.
Returns whether the block supports a playback control.
Returns whether the block has a playback time property.
Query if the given block has a shape property.
Query if the given block has a stroke property.
Queries whether the block supports text animators. Text and caption blocks do. Experimental: this API may change in a minor release.
Returns whether the block has a time offset property.
Checks whether a clip can own an outgoing clip-to-clip transition.
Returns whether the block has trim properties.
Toggles the font weight of the given block between bold and normal. Required scope: "text/character"
Toggles the font style of the given block between italic and normal. Required scope: "text/character"
Toggles the text decoration overline of the given block. Required scope: "text/character"
Toggles the text decoration strikethrough of the given block. Required scope: "text/character"
Toggles the text decoration underline of the given block. Required scope: "text/character"
Ungroups a group.